/**
 * 
 */
package uk.ac.ebi.curtain.utils.file;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * @author mhaimel
 *
 */
public class EntryMapperBean {
	private FileInfo info = null;
	private long filePosition = -1;
	private String id = null;
	private String header = null;
	private String sequence = null;
	private int sequenceLength = -1;
	private String quality = null;
	private String annotations = null;
	
	public EntryMapperBean() {
		// do nothing
	}
	
	public EntryMapperBean(long filePosition, FileInfo info, String id, String header,String sequence) {
		this(filePosition, info, id, header, sequence, StringUtils.EMPTY,StringUtils.EMPTY);
	}
	public EntryMapperBean(long filePosition, FileInfo info, String id, String header,String sequence,String annotations, String quality) {
		super();
		this.filePosition = filePosition;
		this.info = info;
		this.header = header;
		this.id = id;
		this.sequence = sequence;
		this.quality = quality;
		this.annotations = annotations;
	}
	public EntryMapperBean(EntryMapperBean bean) {
		this(
				bean.getFilePosition(),
				bean.getInfo(),
				bean.getId(),
				bean.getHeader(),
				bean.getSequence(),
				bean.getAnnotations(),
				bean.getQuality());
	}

	public FileInfo getInfo() {
		return info;
	}
	public void setInfo(FileInfo info) {
		this.info = info;
	}
	public long getFilePosition() {
		return filePosition;
	}
	public void setFilePosition(long filePosition) {
		this.filePosition = filePosition;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getHeader() {
		return header;
	}
	public void setHeader(String header) {
		this.header = header;
	}
	public String getSequence() {
		return sequence;
	}
	public void setSequence(String sequence) {
		this.sequence = sequence;
	}
	public String getQuality() {
		return quality;
	}
	public void setQuality(String quality) {
		this.quality = quality;
	}
	public String getAnnotations() {
		return annotations;
	}
	public void setAnnotations(String annotations) {
		this.annotations = annotations;
	}	
	
	public int getSequenceLength() {
		if(sequenceLength < 0 && sequence.length() > 0){
			return sequence.length();
		}
		return sequenceLength;
	}

	public void setSequenceLength(int sequenceLength) {
		this.sequenceLength = sequenceLength;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,ToStringStyle.SHORT_PREFIX_STYLE);
	}
}
